//
//  CLOption.m
//  Charles
//
//  Created by Leo on 2019/4/2.
//  Copyright © 2019 charles. All rights reserved.
//

#import "CLOption.h"


typedef NS_OPTIONS(NSUInteger, MyOption) {
    MyOptionNone = 0,
    MyOption1 = 1 << 0,
    MyOption2 = 1 << 1,
    MyOption3 = 1 << 2,
    MyOption4 = 1 << 3,
};


@implementation CLOption

+ (void)test {
    MyOption option = MyOption1 | MyOption2;
    // 添加选项
    option |= MyOption3;
    // 检查是否包含某类型
    if (option & MyOption3) {
        NSLog(@"包含 MyOption3");
    }else {
        NSLog(@"不包含 MyOption3");
    }
    // 移除选项
    option = option & (~MyOption3);
    // 检查是否包含某类型
    if (option & MyOption3) {
        NSLog(@"包含 MyOption3");
    }else {
        NSLog(@"不包含 MyOption3");
    }
}

@end
